<?php

namespace common\models\user;

use Yii;

/**
 * This is the model class for table "{{%user_account_orange}}".
 *
 * @property int $id
 * @property int $user_id
 * @property int $member_id 会员ID
 * @property int $amount 历史累积
 * @property int $current 当前剩余
 * @property int $created_at
 * @property int $updated_at
 * @property int $status 账户状态：-1账户冻结，0未激活，10正常
 */
class UserAccountOrange extends \yii\db\ActiveRecord {

    use \common\traits\TimestampBehavior;

    const STATUS_FORZEN = -1;
    const STATUS_NO_ACTIVE = 0;
    const STATUS_NORMAL = 10;

    /**
     * @inheritdoc
     */
    public static function tableName() {
        return '{{%user_account_orange}}';
    }

    /**
     * @inheritdoc
     */
    public function rules() {
        return [
            [['user_id', 'member_id', 'amount', 'current', 'created_at', 'updated_at'], 'integer'],
            ['status', 'in', 'range' => [self::STATUS_NO_ACTIVE, self::STATUS_FORZEN, self::STATUS_NORMAL]],
            [['user_id'], 'unique'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels() {
        return [
            'id' => 'ID',
            'user_id' => 'User ID',
            'member_id' => '会员ID',
            'amount' => '历史累积',
            'current' => '当前剩余',
            'created_at' => 'Created At',
            'updated_at' => 'Updated At',
            'status' => '账户状态：-1账户冻结，0未激活，10正常',
        ];
    }

}
